問題の説明
android bundleRelease は aab に署名しません (android bundleRelease does not sign the aab)
私は Android アプリを作成しましたが、リリース プロセスの最終ステップはまだ手つかずです。gradle bundleRelease を実行すると、Play ストアにアップロードできる aab ファイルが生成されると思います。しかし、プレイストアはバンドルが署名されていないと言っています. ただし、ビルド プロセスは署名していると言っています:
> Task :app:preBuild UP‑TO‑DATE
> Task :app:preReleaseBuild UP‑TO‑DATE
> Task :app:compileReleaseRenderscript NO‑SOURCE
> Task :app:generateReleaseResValues UP‑TO‑DATE
> Task :app:generateReleaseResources UP‑TO‑DATE
> Task :app:mergeReleaseResources UP‑TO‑DATE
> Task :app:checkReleaseManifest UP‑TO‑DATE
> Task :app:createReleaseCompatibleScreenManifests UP‑TO‑DATE
> Task :app:mainApkListPersistenceRelease UP‑TO‑DATE
> Task :app:processReleaseManifest UP‑TO‑DATE
> Task :app:bundleReleaseResources UP‑TO‑DATE
> Task :app:checkReleaseDuplicateClasses UP‑TO‑DATE
> Task :app:mergeExtDexRelease UP‑TO‑DATE
> Task :app:compileReleaseAidl NO‑SOURCE
> Task :app:generateReleaseBuildConfig UP‑TO‑DATE
> Task :app:prepareLintJar UP‑TO‑DATE
> Task :app:generateReleaseSources UP‑TO‑DATE
> Task :app:javaPreCompileRelease UP‑TO‑DATE
> Task :app:processReleaseResources UP‑TO‑DATE
> Task :app:compileReleaseJavaWithJavac UP‑TO‑DATE
> Task :app:transformClassesWithDexBuilderForRelease UP‑TO‑DATE
> Task :app:mergeDexRelease UP‑TO‑DATE
> Task :app:mergeReleaseShaders UP‑TO‑DATE
> Task :app:compileReleaseShaders UP‑TO‑DATE
> Task :app:generateReleaseAssets UP‑TO‑DATE
> Task :app:mergeReleaseAssets UP‑TO‑DATE
> Task :app:mergeReleaseJniLibFolders UP‑TO‑DATE
> Task :app:transformNativeLibsWithMergeJniLibsForRelease UP‑TO‑DATE
> Task :app:processReleaseJavaRes NO‑SOURCE
> Task :app:transformResourcesWithMergeJavaResForRelease UP‑TO‑DATE
> Task :app:buildReleasePreBundle UP‑TO‑DATE
> Task :app:collectReleaseDependencies UP‑TO‑DATE
> Task :app:configureReleaseDependencies UP‑TO‑DATE
> Task :app:packageReleaseBundle UP‑TO‑DATE
> Task :app:signingConfigWriterRelease UP‑TO‑DATE
> Task :app:signReleaseBundle
> Task :app:bundleRelease
gradle ビルド スクリプトには署名セクションがあります:
android {
...
signingConfigs {
release {
storeFile file(...)
storePassword '...'
keyAlias '...'
keyPassword '...'
}
}
ビルドを実行する前にすべての aab ファイルを削除すると、 app.aab は
..\app\build\outputs\bundle\release
で生成されます Play ストアが aab を受け入れないことを除いて、すべて順調のようです:
The Android App Bundle was not signed.
リリース可能な aab を作成するにはどうすればよいですか?
リファレンスソリューション
方法 1:
If anyone is still looking for a solution ‑ Set debuggable to false in release config. Your app build gradle file should have following ‑
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard‑android‑optimize.txt'), 'proguard‑rules.pro'
signingConfig signingConfigs.release
debuggable = false
}
}
方法 2:
It seems I found the solution here How to create a release signed apk file using Gradle?, apparently an signingConfig entry is needed in the buildType. Below is how that blocks looks in my build file after adding it.
android {
...
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard‑android‑optimize.txt'), 'proguard‑rules.pro'
signingConfig signingConfigs.release
}
}
}
Is it weird that I expected that to already be there? Since I'm not a fan of either IntelliJ or Gradle, I'll chalk my feelings about the whole build and release process up to inexperience with the toolchain. Important is that the app is in the play store.
方法 3:
I had a similar issue where my flavor was being signed incorrectly. I had signing defaults specified in buildTypes
and then overrides in productFlavors
.
buildTypes {
stage {
signingConfig ...
}
release {
signingConfig ...
}
}
productFlavors {
myFlavor {
signingConfig ...
}
</code></pre>
Running ./gradlew bundleMyFlavorStage
was grabbing the wrong signingConfig from buildTypes.stage
instead of the product flavor override. My solution was to remove signingConfig
from buildTypes.stage
and buildTypes.release
and keep the override in the productFlavors
.
方法 4:
You can use ./gradlew :app:bundleRelease
instead of
./gradlew bundleRelease
That works for me!
方法 5:
You can use ./gradlew signReleaseBundle instead of ./gradlew bundleRelease
That works for me!
(by tbeernot、spiraldev、tbeernot、inder_gt、TimLu、jack wang)
リファレンスドキュメント